home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 330 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.6 KB

  1. Path: engnews1.Eng.Sun.COM!taumet!clamage
  2. From: solution@gate.net (Ken Walter)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Observations on templates
  5. Date: 7 Feb 1996 15:57:08 GMT
  6. Organization: Solution Technology
  7. Approved: clamage@eng.sun.com (comp.std.c++)
  8. Message-ID: <4fa6d0$115g@news.gate.net>
  9. References: <ACVI83na99@qsar.chem.msu.su>
  10. NNTP-Posting-Host: taumet.eng.sun.com
  11. Content-Type: text
  12. X-Nntp-Posting-Host: dfbfl2-21.gate.net
  13. X-Newsreader: NeoLogic News for OS/2 [version: 4.2]
  14. Content-Length: 835
  15. X-Lines: 28
  16. Originator: clamage@taumet
  17.  
  18. In message <3114137D.CFC@suphys.physics.su.oz.au> - John Max Skaller <maxtal@su
  19. phys.physics.su.oz.au> writes:
  20. :>
  21. :>Eugene Radchenko wrote:
  22. :>> Why don't use, for instance, cast_d instead od
  23. :>> dynamic_cast (ugh). 
  24. :>
  25. :>      This is quite deliberate. Bjarne dislikes casts. So do I.
  26. :>He didn't invent new style casts (and RTTI) for your convenience, 
  27. :>he invented them to make sure no one else did. Long names were deliberately
  28. :>chosen to discourage use of casts.
  29. :>
  30. But dynamic casts are almost required to do anything.
  31.  
  32. I always thought the following was interesting:
  33.  
  34. template <class T, class S> T cast_d( S s) { return dynamic_cast<T>s; }
  35.  
  36. and the expression:
  37.  
  38. cast_d<T>(s)
  39.  
  40. Casts could almost be implemented without being part of the language.
  41.  
  42. Ken Walter
  43.  
  44. * All the above is hearsay and the opinion of nobody in particular
  45.  
  46.  
  47. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  48.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy is
  49.   summarized in http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
  50. ]
  51.